#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
#include <ctype.h>
find_word(char t[], char w[])
{
	char s[20];
	int i, j, k = 0;
	for (i = 0; t[i] != '\0'; i++)
	{
		if (isalpha(t[i]))
		{
			for (j = 0; isalpha(t[i + j]); j++)
				s[j] = t[i+j];
			s[j] ='\0';
			if (strcmp(w, s) == 0)
				return 1;
			i = i+j;
		}
	}
	return -1;
}
 main()
{
	char test[80] = "I will pass the examination in the summer holiday.", word[20];
	int t;
	puts("enter a word to be found:");
	gets(word);
	t = find_word(test,word);
	if (t!=-1)
		printf("The word %s in text . It locates in %d.\n", word, t);
	else
		printf("not found!\n");
}

